<?php

/**
 * ImageModel
 *  
 * @author Nguyen Hai Ha
 * @version 
 */

class ImageModel {
	/**
	 * The default table name 
	 */
	protected $_name = 'eway_image';
	protected $_dbAdapter;
	
	function ImageModel(){
		$this->_dbAdapter = Zend_Registry::get(Constant::DB_ADAPTER);
	}

	public function insert( $image = array() ) {
		$this->_dbAdapter->insert ( $this->_name, $image );
		$id = $this->_dbAdapter->lastInsertId ();
		return $id;
	}
	
	public function getImageByComId($com_id){
		$sql = "SELECT * FROM " . $this->_name . " WHERE com_id=?";
		$result = $this->_dbAdapter->fetchAll($sql, $com_id);
		return $result;
	}
	
}
